package com.reza.simpd.validator
{
	import mx.validators.Validator;	
	import mx.validators.ValidationResult;
	
	public class ValidatorPassword extends Validator
	{
		private var _valueToCompare:Object;

		public function ValidatorPassword()
		{
			super();
		}
		
		public function get valueToCompare():Object
		{
			return _valueToCompare;
		}
		
		public function set valueToCompare(value:Object):void
		{
			_valueToCompare = value;
		}
		
		override protected function doValidation(value:Object):Array 
		{
			var result:Array = [];
			var srcVal:Object = this.getValueFromSource();
			
			if (srcVal != valueToCompare)
			{
				result.push(new ValidationResult(true, null, "Cocok", "Password tidak cocok"));
			}
			
			return result;
		}
	}
}